#include "cobra11syndicate.hlsli"
#include "standard.hlsli"

struct VS_Input_C11Auto 
{
float4 position : Position /* dcl_position v0 */ ;
float4 normal : normal /* dcl_normal v1 */ ;
float4 texcoord1 : texcoord1 /* dcl_texcoord v2 */ ;
float4 texcoord2 : texcoord2 /* dcl_texcoord1 v3 */ ;
float4 vertexColor : color1 /* dcl_color v4 */ ;
float4 DiffuseColor : color0 /* dcl_color1 v5 */ ;
};




struct PS_Input_C11Auto
{
float4 position : SV_Position /* dcl_position o0 */ ;
float3 normal : texcoord /* dcl_texcoord o3.xyz */ ;
float4 distanceToCamera : texcoord1 /* dcl_texcoord1 o4 */ ;
float4 texCoord5 : texcoord2 /* dcl_texcoord2 o5 */ ;
float4 texCoord6 : texcoord4 /* dcl_texcoord4 o6 */ ;
float4 texCoord7 : texcoord6 /* dcl_texcoord6 o7 */ ;
float3 texCoord8 : texcoord7 /* dcl_texcoord7 o8.xyz */ ;
float4 diffuseColor : texcoord8 /* dcl_texcoord8 o2 */ ;
float4 VertexColor : color /* dcl_color o1 */ ;
};


PS_Input_C11Auto vs_main(VS_Input_C11Auto vsInAuto) 
{

float4 c0 = float4(0.0199999996, 0.100000001, 2.5, -1.44269502); // def c0, 0.0199999996, 0.100000001, 2.5, -1.44269502
float4 c1 = float4(2, -1, 1, 0); // def c1, 2, -1, 1, 0


PS_Input_C11Auto psInAuto = (PS_Input_C11Auto)0;
float4 r0 = (float4)0;
float4 r1 = (float4)0;
float4 r2 = (float4)0;



r0.xyz = vsInAuto.normal.xyz * c1.x +  c1.y;//mad r0.xyz, v1, c1.x, c1.y
r0.w = dot(r0.xyz, r0.xyz);//dp3 r0.w, r0, r0
r0.w = rsqrt(r0.w);//rsq r0.w, r0.w
psInAuto.normal.xyz = r0.w * r0.xyz;//mul o3.xyz, r0.w, r0
r0.xyz = WorldOffset.xyz + vsInAuto.position.xyz;//add r0.xyz, c33, v0
r1.xyz = -r0.xyz + g_CameraPosition.xyz;//add r1.xyz, -r0, c32
r1.w = dot(r1.xyz, r1.xyz);//dp3 r1.w, r1, r1
r1.w = rsqrt(r1.w);//rsq r1.w, r1.w
r2.x = 1.0f / r1.w;//rcp r2.x, r1.w
r2.x = r2.x * c0.x;//mul r2.x, r2.x, c0.x
r2.x = max(r2.x, c0.y);//max r2.x, r2.x, c0.y
r2.x = min(r2.x, c0.z);//min r2.x, r2.x, c0.z
r2.xyz = r1.xyz * r2.x;//mul r2.xyz, r1, r2.x
psInAuto.distanceToCamera.xyz = r1.xyz;//mov o4.xyz, r1
r1.xyz = r2.xyz * r1.w +  r0.xyz;//mad r1.xyz, r2, r1.w, r0
r1.w = vsInAuto.position.w;//mov r1.w, v0.w
psInAuto.position.x = dot(r1.xyzw, worldViewProj._m00_m10_m20_m30);// dp4 o0.x, r1, c20
psInAuto.position.y = dot(r1.xyzw, worldViewProj._m01_m11_m21_m31);// dp4 o0.y, r1, c21
psInAuto.position.z = dot(r1.xyzw, worldViewProj._m02_m12_m22_m32);// dp4 o0.z, r1, c22
psInAuto.position.w = dot(r1.xyzw, worldViewProj._m03_m13_m23_m33);// dp4 o0.w, r1, c23
r0.w = vsInAuto.position.w;//mov r0.w, v0.w
psInAuto.texCoord7.w = dot(r0.xyzw, view._m02_m12_m22_m32);// dp4 o7.w, r0, c11
r1.xyz = r0.xyz + -g_CameraPosition.xyz;//add r1.xyz, r0, -c32
r0.xyzw = r0.xyzx * c1.zzzw +  c1.wwwz;//mad r0, r0.xyzx, c1.zzzw, c1.wwwz
r1.xyz = r1.xyz * RangeFog.w;//mul r1.xyz, r1, c31.w
r1.x = dot(r1.xyz, r1.xyz);//dp3 r1.x, r1, r1
r1.x = r1.x * c0.w;//mul r1.x, r1.x, c0.w
psInAuto.distanceToCamera.w = exp(r1.x);//exp o4.w, r1.x
r1.xyz = vsInAuto.DiffuseColor.xyz * vsInAuto.DiffuseColor.xyz;//mul r1.xyz, v5, v5
r1.xyz = r1.xyz * AmbLevel.xyz;//mul r1.xyz, r1, c30
r1.w = vsInAuto.DiffuseColor.w;//mov r1.w, v5.w
psInAuto.diffuseColor.xyzw = r1.xyzw + TerrainAmbient.xyzw;//add o2, r1, c48
r1.xyz = vsInAuto.texcoord1.xyx * c1.zzw +  c1.wwz;//mad r1.xyz, v2.xyxw, c1.zzww, c1.wwzw
r2.x = dot(r1.xyz, TexMat1._m00_m10_m20);//dp3 r2.x, r1, c34
r2.y = dot(r1.xyz, TexMat1._m01_m11_m21);//dp3 r2.y, r1, c35
psInAuto.texCoord5.zw = r2.xy * TexUVMod1.z +  TexUVMod1.xy;//mad o5.zw, r2.xyxy, c38.z, c38.xyxy
psInAuto.texCoord5.xy = r2.xy;//mov o5.xy, r2
r1.xyz = vsInAuto.texcoord2.xyx * c1.zzw +  c1.wwz;//mad r1.xyz, v3.xyxw, c1.zzww, c1.wwzw
r2.x = dot(r1.xyz, TexMat2._m00_m10_m20);//dp3 r2.x, r1, c36
r2.y = dot(r1.xyz, TexMat2._m01_m11_m21);//dp3 r2.y, r1, c37
psInAuto.texCoord6.zw = r2.xy * TexUVMod2.z +  TexUVMod2.xy;//mad o6.zw, r2.xyxy, c39.z, c39.xyxy
psInAuto.texCoord6.xy = r2.xy;//mov o6.xy, r2
psInAuto.texCoord8.x = dot(r0.xyzw, ShadowMtx._m00_m10_m20_m30);// dp4 o8.x, r0, c24
psInAuto.texCoord8.y = dot(r0.xyzw, ShadowMtx._m01_m11_m21_m31);// dp4 o8.y, r0, c25
psInAuto.texCoord8.z = dot(r0.xyzw, ShadowMtx._m02_m12_m22_m32);// dp4 o8.z, r0, c26
psInAuto.texCoord7.xyz = r0.xyz;//mov o7.xyz, r0
psInAuto.VertexColor.xyzw = vsInAuto.vertexColor.xyzw;//mov o1, v4
return psInAuto;
}


